<script src="/static/js/jquery.min.js" charset="utf-8"></script>
<script src="/static/admin/layui.js" charset="utf-8"></script>
<script src="/static/js/vue.js" charset="utf-8"></script>
<script src="/static/js/fuck.js" charset="utf-8"></script>
<script>
    const PostCommon = {
        version: 10000,
        plat: 'admin',
        access_token: '{$access_token??""}'
    };
    window.onload = function () {
        $(".layui-side-scroll").on('mouseover', function () {
            $(this).css('overflow-y', 'auto');
        });
        $(".layui-side-scroll").on('mouseout', function () {
            $(this).css('overflow-y', 'hidden');
        });
    };

    function logout() {
        _confirm('是否确认退出当前登录的账号？', '注销提醒', function () {
            location.href = '/admin/logout';
        });
    }
    var iframe;

    function openFrame(url, title = "请你操作", width = "600", height = "400") {
        iframe = layer.open({
            type: 2,
            skin: 'layui-layer-demo',
            area: [width + "px", height + "px"],
            fixed: true, //不固定
            maxmin: true,
            title: title,
            content: url,
            end: function () {
                app.getList();
            }
        });
    }

    function closewindow() {
        layer.close(iframe);
    }
    var alertLayer;

    function _alert(content, title = "系统提示", callback = null) {
        alertLayer = layer.confirm(
            '<div class="pl-20 pr-20 pt-20 pb-20">' +
            "&nbsp;&nbsp;&nbsp;&nbsp;" + content + "&nbsp;&nbsp;&nbsp;&nbsp;" +
            '</div>', {
            skin: 'layui-layer-demo',
            btn: ["确定"],
            closeBtn: 1,
            shade: [0.5, "#333"],
            shadeClose: false,
            title: title
        },
            function () {
                layer.close(alertLayer);
                if (callback != null) {
                    callback();
                }
            }
        );
    }
    var confirmLayer;

    function _confirm(content, title = "系统提示", callback = null) {
        confirmLayer = layer.confirm(
            '<div class="pl-20 pr-20 pt-20 pb-20">' +
            "&nbsp;&nbsp;&nbsp;&nbsp;" + content + "&nbsp;&nbsp;&nbsp;&nbsp;" +
            '</div>', {
            skin: 'layui-layer-demo',
            btn: ["确认", "取消"],
            closeBtn: 1,
            shade: [0.5, "#333"],
            shadeClose: false,
            title: title
        },
            function () {
                layer.close(confirmLayer);
                if (callback != null) {
                    callback();
                }
            });
    }
    var loading;

    function _loading(msg = "加载中") {
        loading = layer.open({
            type: 1,
            closeBtn: 0,
            shade: [0.1, "#333"],
            shadeClose: false,
            title: false,
            resize: false,
            content: '<div style="padding:10px;padding-left:30px;padding-right:30px;">' +
                msg +
                '</div>'
        });
    }

    function _hideLoading() {
        layer.close(loading);
    }
    Date.prototype.Format = function (fmt) { //author: meizz
        var o = {
            "M+": this.getMonth() + 1,
            "d+": this.getDate(),
            "h+": this.getHours(),
            "m+": this.getMinutes(),
            "s+": this.getSeconds(),
            "q+": Math.floor((this.getMonth() + 3) / 3),
            "S": this.getMilliseconds()
        };
        if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
        for (var k in o)
            if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
        return fmt;
    };

    function time2string(nS) {
        return new Date(parseInt(nS) * 1000).Format("MM-dd hh:mm");
    }
    /**
     * 日期格式化 2019-07-23
     */
    function formatDate(date) {
        var myyear = date.getFullYear();
        var mymonth = date.getMonth() + 1;
        var myweekday = date.getDate();

        if (mymonth < 10) {
            mymonth = "0" + mymonth;
        }
        if (myweekday < 10) {
            myweekday = "0" + myweekday;
        }
        return (myyear + "-" + mymonth + "-" + myweekday); //想要什么格式都可以随便自己拼
    }
    /**
     * 将数值四舍五入(保留2位小数)后格式化成金额形式
     *
     * @param num 数值(Number或者String)
     * @return 金额格式的字符串,如'1,234,567.45'
     * @type String
     */
    function formatCurrency(num) {
        num = num.toString().replace(/\$|\,/g, '');
        if (isNaN(num))
            num = "0";
        var sign = (num == (num = Math.abs(num)));
        num = Math.floor(num * 100 + 0.50000000001);
        var cents = num % 100;
        num = Math.floor(num / 100).toString();
        if (cents < 10)
            cents = "0" + cents;
        for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++)
            num = num.substring(0, num.length - (4 * i + 3)) + ',' + num.substring(num.length - (4 * i + 3));
        return (((sign) ? '' : '-') + num + '.' + cents);
    }

    function parseTimes(timestamp) {
        var d = new Date(timestamp * 1000); //根据时间戳生成的时间对象
        var date = "";
        // date += (d.getFullYear()) + "-";
        var _month = d.getMonth() + 1;
        date += (_month < 10 ? ("0" + _month) : _month) + "-";
        date += (d.getDate() < 10 ? ("0" + d.getDate()) : d.getDate()) + " ";
        date += (d.getHours() < 10 ? ("0" + d.getHours()) : d.getHours()) + ":";
        date += (d.getMinutes() < 10 ? ("0" + d.getMinutes()) : d.getMinutes());
        // date += (d.getSeconds());
        return date;
    }

    function parseDate(timestamp) {
        var d = new Date(timestamp * 1000); //根据时间戳生成的时间对象
        var date = "";
        date += (d.getFullYear()) + "-";
        var _month = d.getMonth() + 1;
        date += (_month < 10 ? ("0" + _month) : _month) + "-";
        date += (d.getDate() < 10 ? ("0" + d.getDate()) : d.getDate());
        return date;
    }

    function parseDatetime(timestamp) {
        var d = new Date(timestamp * 1000); //根据时间戳生成的时间对象
        var date = "";
        date += (d.getFullYear()) + "-";
        var _month = d.getMonth() + 1;
        date += (_month < 10 ? ("0" + _month) : _month) + "-";
        date += (d.getDate() < 10 ? ("0" + d.getDate()) : d.getDate()) + " ";
        date += (d.getHours() < 10 ? ("0" + d.getHours()) : d.getHours()) + ":";
        date += (d.getMinutes() < 10 ? ("0" + d.getMinutes()) : d.getMinutes()) + ":";
        date += (d.getSeconds() < 10 ? ("0" + d.getSeconds()) : d.getSeconds());
        return date;
    }

    function parseDatetimeSimple(timestamp) {
        var d = new Date(timestamp * 1000); //根据时间戳生成的时间对象
        var date = "";
        var _month = d.getMonth() + 1;
        date += (_month < 10 ? ("0" + _month) : _month) + "-";
        date += (d.getDate() < 10 ? ("0" + d.getDate()) : d.getDate()) + " ";
        date += (d.getHours() < 10 ? ("0" + d.getHours()) : d.getHours()) + ":";
        date += (d.getMinutes() < 10 ? ("0" + d.getMinutes()) : d.getMinutes());
        return date;
    }

    function nowDateTimeSimple() {
        var d = new Date(); //根据时间戳生成的时间对象
        var date = "";
        var _month = d.getMonth() + 1;
        date += (_month < 10 ? ("0" + _month) : _month) + "-";
        date += (d.getDate() < 10 ? ("0" + d.getDate()) : d.getDate()) + " ";
        date += (d.getHours() < 10 ? ("0" + d.getHours()) : d.getHours()) + ":";
        date += (d.getMinutes() < 10 ? ("0" + d.getMinutes()) : d.getMinutes());
        return date;
    }

    function nowdate() {
        var d = new Date(); //根据时间戳生成的时间对象
        var date = "";
        var _month = d.getMonth() + 1;
        date += (d.getFullYear()) + "-";
        date += (_month < 10 ? ("0" + _month) : _month) + "-";
        date += (d.getDate() < 10 ? ("0" + d.getDate()) : d.getDate());
        return date;
    }
</script>